import { getPlayerData, isPlayerExist } from '../l.js'

export class Fs extends plugin {
    constructor() {
        super({
            name: '[Fs]农场信息',
            dsc: '农场信息',
            event: 'message',
            priority: 1,
            rule: [
                { reg: /^(#|\/)?农场信息$/, fnc: 'farmInformation' }
            ]
        })
    }
    async farmInformation(e) {
        const PLAYER_ID = e.user_id
        if (!isPlayerExist(PLAYER_ID)) {
            return e.reply(['无玩家信息，请发送[领取田地]'])
        }
        const PLAYER_DATA = await getPlayerData(PLAYER_ID)

        const msg = [
            '您的农场信息如下:',
            `💰[${PLAYER_DATA['capital']}] XP[${PLAYER_DATA['xp'] || 0}]`
        ].join('\r')
        return e.reply(msg)
    }
}